package com.sg.service.biz.bff.nb;

import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.wicket.okrbff.common.domain.redis.PrivacyInfoForRedis;
import com.wicket.okrcomponent.common.annotations.BanAuto;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ： 手工接入方法
 * @version 1.0
 * @since 2022/5/28 15:32
 */
@Service
@BanAuto
public class NbPower {

    @Resource
    private RedisUtil redisUtil;

    /**
     * code:getUserAllPower
     * name:D1-获取用户全部权限
     * desc:undefined
     **/
    @BanAuto
    public GetUserAllPowerRespDto getUserAllPower(GetUserAllPowerReqDto reqDto) {
        GetUserAllPowerRespDto retData = new GetUserAllPowerRespDto();
        List<PrivacyInfoForRedis> powerList = CommonFunctionHelper.getUserAllPower(redisUtil, reqDto.getOriginalRoleMemberId());
        retData.setPowerCodeList(powerList.stream().map(p -> p.getPrivacyCode()).collect(Collectors.toList()));
        return retData;
    }
    //手工接入方法
}
